<?php
namespace Home\Controller;
use Think\Controller;

class AdminController extends Controller {
    public function index(){
        $dao = M('User');
		$count=$dao->count();
		if($count>0){
			$page= new \Think\Page($count,25);
			$page_show=$page->show();
	        $userInfo = $dao->limit($page->firstRow.','.$page->listRows)->select();
	        $this->assign('lists',$userInfo);
	        $this->assign('page_show',$page_show);
		}
        $this->display();
    }
	
	function add(){
		if(IS_POST){
            $userModel = D('User');
            $userInfoArray = $userModel->create();
            //$this->UploadsImg($data,$options);
            $id = $userModel->add($userInfoArray);
            if($id){
                $this->success('添加成功');
            }else{
            		$this->error('添加失败请重试');
            }
        }else{
        		
            $this->display();
        }
	}
}